#include <boost/format.hpp>
#include <iostream>

int main()
{
	std::cout << boost::format("%1%.%2%.%3%") % 24 % 3 % 2012 << std::endl; //* March 24, 2012

	std::cout << boost::format("%2%/%1%/%3%") % 24 % 3 % 2012 << std::endl; //* change parameter position
	//*use C++ manipulators
	std::cout << boost::format("%1% %2% %1%") % boost::io::group(std::showpos, 99) % 100 << std::endl; //* +99 100 +99

	std::cout << boost::format("%|1$+| %2% %1%") % 99 % 100 << std::endl; //* +99 100 99

	try {
		std::cout << boost::format("%|+| %2% %1%") % 99 % 100 << std::endl;
	}
	catch (boost::io::format_error &ex) {
		std::cout << ex.what() << std::endl; //* catch boost::io::bad_format_string
	}

	std::cout << boost::format("%|+| %|| %||") % 99 % 100 % 99 <<std::endl; //* +99 100 99

	std::cout << boost::format("%+d %d %d") % 99 % 100 % 99 <<std::endl; //* +99 100 99 apply std::dec()

	std::cout << boost::format("%+s %s %s") % 99 % 100 % 99 <<std::endl; //* +99 100 99 (still works)
}